package com.job.createType.simpleFactory;

import com.job.common.exception.ServiceException;

/**
 * @Author 王博
 * @DateTime 2025-04-08 11:03
 */
public class CoffeeFactory {
    public Coffee createCoffee(String type) {
        switch (type) {
            case "american":
                return new AmericanCoffee();
            case "lattee":
                return new LatteeCoffee();
            case "ku":
                return new KuCoffee();
            default:
                throw new ServiceException("传参错误");
        }
    }
}
